<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jspf/must/basePath.jspf" %>

<!--后台UI组件Start-->
<%@include file="/WEB-INF/jspf/zj/ligerui/LigerUI.jspf" %>
<%--<%@include file="/WEB-INF/jspf/zj/ligerui/LigerUI_form.jspf" %>--%>
<!--后台UI组件End-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript">
//-------------------------------全局变量-------------------------------------------------

            $(function() {
                var USERID = "${param.user_id}";
                var USER_ROLES = myajax("weixinkeji/dev/power/center/sysur/manager/s/userRole1N.imy", {"uID": USERID});
                var GRID = $("#divID_GRID_RCHECKBOX").ligerGrid({
                    columns: [
                        {display: '称号', name: 'role_name', width: 190, align: 'left'}
                        , {display: '备注', name: 'role_info', width: 190, align: 'left'}
                        , {display: '创建时间', name: 'cdate', width: 120, align: 'center'}
                    ]
                    , usePager: false
                    , checkbox: true
                    , url: 'weixinkeji/dev/power/role/sysrole/manager/s.imy'
                    , width: '100%;'
                    , height: '97%'
                    , isChecked: f_isChecked
                });
                $("#toptoolbar").ligerToolBar({items: [
                        {text: '确认', click: save}
                    ]});
                function f_isChecked(data) {
                    for (var i = 0; i < USER_ROLES.length; i++) {
                        if (USER_ROLES[i].role_id == data.role_id) {
                            return true;
                        }
                    }
                    return false;
                }

                function save() {
                    var sdata = GRID.getSelectedRows();
                    var ids = "";
                    if (sdata.length > 0) {
                        for (var i = 0; i < sdata.length; i++) {
                            ids = ids + ",'" + sdata[i].role_id + "'";
                        }
                        post_json("weixinkeji/dev/power/center/sysur/adu/add.imy", {"uID": USERID, "rID": ids.substring(1)}, 400, 200);
                    } else {
                        post_json("weixinkeji/dev/power/center/sysur/adu/add.imy", {"uID": USERID}, 400, 200);
                    }
                }
            });
//-------------------------------GRID列函数-----------------------------------------------

//-------------------------------增删改操作-----------------------------------------------

        </script>
    </head>
    <body>
        <div id="toptoolbar"></div>
        <div id="divID_GRID_RCHECKBOX" style="margin:0; padding:0;"></div>
    </body>
</html>
